
const MAP={
		'/session/wx/applet':'wxApplet()',
		'/session/refresh':'refresh()',
	}
class JQSessionController extends  global.JQBaseController {
    constructor(url,conn,req_obj) {
		super(url,conn,req_obj,true);
		if(!conn)console.log('order controller conn is error');
		else console.log('order controller conn is ok');
		this.conn= conn;
       // super.name = name;
    }
	
	//生成订单
	async wxApplet(){
		
		const service = global.JQService.instance(
		  //'session_sevice'
			'session_service/wx_applet',this.conn,this.req_obj,this.params);
		let data =service.do_action();
		return data;
		//console.log('obj::' + obj);
	}
	
	async refresh(){
 
 	console.log('controller refresh')
		const service = global.JQService.instance(
		  //'session_sevice'
			'session_service/refresh',this.conn,this.req_obj,this.params);
		console.log('constoller refresh 222');
		let data =service.do_action();
		return data;
		//console.log('obj::' + obj);
	}
	
	
    async  dispatch() {
		super.dispatch();
		
		let req = this.req_obj;
		let func = MAP[this.url];
		
		if(func){
			console.log('dispatch'+ '  ' +  func);
			func = 'this.'+func;
			console.log('dispatch'+ '  ' +  func);
			let res_data = await eval(func);
			return res_data;
		}else return null;
		
		
    }
	
	
}
module.exports = JQSessionController;